import { axios } from '@/utils/request'

/**
 * 第三方账号登录
 * @returns {*}
 */
export function thirdLogin(data) {
  return axios({
    url: '/admin/thirdLogin',
    headers: {
      isToken: false
    },
    method: 'post',
    data: data
  })
}

/**
 * 获取第三方登录请求地址
 * @param source
 * @param tenantId
 * @returns {*}
 */
export function thirdBinding(source,tenantId) {
  return axios({
    url: '/admin/third/binding/' + source,
    method: 'get',
    params: {
      tenantId: tenantId,
      domain: window.location.host
    }
  })
}

/**
 * 第三方回调,绑定账号
 */
export function callback(data) {
  return axios({
    url: '/admin/third/callback',
    method: 'post',
    data: data
  });
}

/**
 * 解绑第三方账号
 * @param authId
 * @returns {*}
 */
export function authUnlock(id) {
  return axios({
    url: '/admin/third/unlock/' + id,
    method: 'delete'
  })
}

/**
 * 查询当前用户绑定的第三方授权列表
 * @returns {*}
 */
export function getAuthList() {
  return axios({
    url: '/auth/user/list',
    method: 'get'
  });
}


